var chessboard = [];
var box = document.getElementById("box");

function creatChessBoard() {

	var tr, td;
	for(var i = 0; i < 20; i++) {
		chessboard[i] = [];
		tr = document.createElement("tr")
		for(var j = 0; j < 10; j++) {
			chessboard[i][j] = 0;
			var td = document.createElement("td")
			tr.appendChild(td);
		}
		box.appendChild(tr)
	}
	return chessboard;
}
creatChessBoard();

//绘制图形
function paint() {
	for(var i = 0; i < 4; i++) {
		box.rows[activeBlock[i * 2]].cells[activeBlock[i * 2 + 1]].innerText = i;
		box.rows[activeBlock[i * 2]].cells[activeBlock[i * 2 + 1]].style.backgroundColor = "red";
	}
}

//擦除当前图形
function erase() {
	for(var i = 0; i < 4; i++) {
		box.rows[activeBlock[i * 2]].cells[activeBlock[i * 2 + 1]].style.backgroundColor = "";
	}
}

//更新chessboard数组 
function updateBoard() {
	for(var i = 0; i < 4; i++) {
		chessboard[activeBlock[2 * i]][activeBlock[2 * i + 1]] = 1;
	}
}